import HTTPREQUEST from "./http"

// 获取用户信息和学校信息
export const getUserAndSchoolInfo = ({ url, data, header }) => HTTPREQUEST.get(url, data, header)

//获取todo的列表信息
export const getTodoInfo = ({ url, data, header }) => HTTPREQUEST.get(url, data, header)

// 记录各消息类型最后读取时间
export const getLastReadTime = ({ url, data, header }) => HTTPREQUEST.post(url, data, header)

//根据用户ID获取各类型未读消息
export const reqNewRemindCount = ({ url, data, header }) => HTTPREQUEST.get(url, data, header)

// 获取系统消息列表
export const reqSystemMes = ({ url, data, header }) => HTTPREQUEST.get(url, data, header)

// 批量删除
export const reqDelAllChoose = ({ url, data, header }) => HTTPREQUEST.delete(url, data, header)

// 批量已读
export const reqReadAllChoose = ({ url, data, header }) => HTTPREQUEST.put(url, data, header)

// 删除系统消息
export const reqDelSystemMes = ({ url, data, header }) => HTTPREQUEST.post(url, data, header)


// 屏蔽系统消息
export const reqShiledSystemMes = ({ url, data, header }) => HTTPREQUEST.post(url, data, header)

// 获取屏蔽设置
export const reqSettingInfo = ({ url, data, header }) => HTTPREQUEST.get(url, data, header)

// 获取在线交流设置
export const reqShiledSetting = ({ url, data, header }) => HTTPREQUEST.get(url, data, header)

// 单个switch的请求
export const reqLevelTwoCheck = ({ url, data, header }) => HTTPREQUEST.post(url, data, header)

export const getData = (data) => HTTPREQUEST.get('/api/board', data)
export const postData = (data, header) => HTTPREQUEST.post('/api/board', data, header)
export const putData = (data, header) => HTTPREQUEST.put('/api/board', data, header)
export const delData = (data, header) => HTTPREQUEST.delete('/api/board', data, header)

export const HttpGet = ({ url, data = {}, header = {}, load = false, cookie = false, showError = true }) => HTTPREQUEST.get(url, data, header, load, cookie, showError)
export const HttpPost = ({ url, data = {}, header = {}, load = false }) => HTTPREQUEST.post(url, data, header, load)
export const HttpPut = ({ url, data = {}, header = {}, load = false }) => HTTPREQUEST.put(url, data, header, load)
export const HttpDelete = ({ url, data = {}, header = {}, load = false }) => HTTPREQUEST.delete(url, data, header, load)

export const transmitFormData = (data) => HTTPREQUEST.transmitFormData(data) //小程序内formData请求（小程序不支持formData请求，走校园通代理）


// =========================================== 消息中心推送设置 ====================================================================
// 获取系统列表
export async function getSystemListService(schoolId, beSchoolLevel) {
    const url = '/api/setting/list/sys'
    const result = await HttpGet({ url, data: { schoolId, beSchoolLevel } })

    return result
}

// 获取设置列表
export async function getSettingListService(opt) {
    const url = '/api/setting/list//msg/setting'
    const result = await HttpGet({ url, data: opt })

    return result
}

// 改变系统推送状态
export async function changeSystemStatusService(opt) {
    const url = '/api/setting/manage/update/status'
    const result = await HttpPost({ url, data: opt, load: true })

    return result
}